package com.unittec.zk.provider.auth.service;

import com.unittec.zk.provider.auth.entity.SysFormEntity;
import com.unittec.zk.provider.auth.mapper.SysFormMapper;
import com.unittec.zk.provider.root.ServiceRoot;
import com.unittec.zk.provider.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class SysFormService extends ServiceRoot<SysFormMapper, SysFormEntity> {
    @Autowired
    private SysFormMapper sysFormMapper;

    /**
     * 查询流程表单
     *
     * @param formId 流程表单ID
     * @return 流程表单
     */
    public SysFormEntity selectSysFormById(Long formId)
    {

        return sysFormMapper.selectSysFormById(formId);
    }

    /**
     * 查询流程表单列表
     *
     * @param sysForm 流程表单
     * @return 流程表单
     */
    public List<SysFormEntity> selectSysFormList(SysFormEntity sysForm)
    {
        return sysFormMapper.selectSysFormList(sysForm);
    }

    /**
     * 新增流程表单
     *
     * @param sysForm 流程表单
     * @return 结果
     */
    public int insertSysForm(SysFormEntity sysForm)
    {
        sysForm.setCreateTime(new Date());
        return sysFormMapper.insertSysForm(sysForm);
    }

    /**
     * 修改流程表单
     *
     * @param sysForm 流程表单
     * @return 结果
     */
    public int updateSysForm(SysFormEntity sysForm)
    {
        sysForm.setModifyTime(new Date());
        return sysFormMapper.updateSysForm(sysForm);
    }

    /**
     * 批量删除流程表单
     *
     * @param formIds 需要删除的流程表单ID
     * @return 结果
     */
    public int deleteSysFormByIds(Long[] formIds)
    {

        return sysFormMapper.deleteSysFormByIds(formIds);
    }

    /**
     * 删除流程表单信息
     *
     * @param formId 流程表单ID
     * @return 结果
     */
    public int deleteSysFormById(Long formId)
    {

        return sysFormMapper.deleteSysFormById(formId);
    }
}
